package com.qf.lanzhou.blog.api.controller;

import com.qf.lanzhou.blog.api.service.ArticleService;
import com.qf.lanzhou.blog.api.service.impl.ArticleServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Yeach-chen
 * @ClassName ArticleViewServlet
 */
@WebServlet("/articleView.do")
public class ArticleViewServlet extends BaseServletPost{
   private ArticleService articleService=new ArticleServiceImp();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取文章ID
        String articleId1 = req.getParameter("articleId");
        System.out.println("文章ID:"+articleId1);
        //id转成int类型
        int articleId = Integer.parseInt(articleId1);
        int result = articleService.AddArticleView(articleId);
        successResultWrite(result,resp);
    }
}
